import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

// import login from '../Views/login.vue'
const login = r => require(["../Views/login.vue"], r);
const manage = r => require(["../Views/manage.vue"], r);
const hello = r => require(["../../../components/hello.vue"], r);
const emty = r => require(["../Views/emty.vue"], r);
const test = r => require(["../Views/test.vue"], r);
const swagger = r => require(["../Views/swagger.vue"], r);
const notfound = r => require(["../Views/notfound.vue"], r);
const webdav = r => require(["../Views/system/webdav.vue"], r);
const stbp = r => require(["../Views/stbp.vue"], r);

//system
const system = r => require(["../Views/system/system.vue"], r);
const NetSetting = r => require(["../Views/system/NetSetting.vue"], r);
const RunningInfo = r => require(["../Views/system/RunningInfo.vue"], r);
const SysStorage = r => require(["../Views/system/SysStorage.vue"], r);
const SystSetting = r => require(["../Views/system/SystSetting.vue"], r);

//media
const media = r => require(["../Views/media/media.vue"], r);
const InputDevSetting = r => require(["../Views/media/InputDevSetting.vue"], r);
const InputChannelSetting = r => require(["../Views/media/InputChannelSetting.vue"], r);
const OutputDevSetting = r => require(["../Views/media/OutputDevSetting.vue"], r);
const OutputChannelSetting = r => require(["../Views/media/OutputChannelSetting.vue"], r);
const multicast = r => require(["../Views/media/multicast.vue"], r);
const StreamPull = r => require(["../Views/media/StreamPull.vue"], r);
const StreamPush = r => require(["../Views/media/StreamPush.vue"], r);
const StreamSwitch = r => require(["../Views/media/StreamSwitch.vue"], r);
const AudioSwitch = r => require(["../Views/media/AudioSwitch.vue"], r);
const LayoutSwitch = r => require(["../Views/media/LayoutSwitch.vue"], r);
const LayoutManage = r => require(["../Views/media/LayoutManage.vue"], r);

//Kvm
const Kvm = r => require(["../Views/Kvm/Kvm.vue"], r);
const kvmDetail = r => require(["../Views/Kvm/kvmDetail.vue"], r);
const COMSetting = r => require(["../Views/Kvm/COMSetting.vue"], r);
const IRSetting = r => require(["../Views/Kvm/IRSetting.vue"], r);

//Kvm
const Debug = r => require(["../Views/Debug/Debug.vue"], r);
const PacketCapture = r => require(["../Views/Debug/PacketCapture.vue"], r);

const routes = [{
  path: "/login",
  component: login
}, {
  path: "/emty",
  component: emty
}, {
  path: "/test",
  component: test
}, {
  path: "/stbp",
  component: stbp
}, {
  path: "/swagger",
  component: swagger
}, 
{
  path: "/",
  component: manage,
  children: [{
      path: "",
      component: system,
      redirect: "/system"
    },
    {
      //system-------------------------------
      path: "/system",
      component: system,
      meta: "system",
      name: "system",
      children: [{
          path: "",
          component: SystSetting,
          redirect: "/system/syssetting"
        },
        {
          path: "syssetting",
          component: SystSetting,
          meta: "syssetting",
          name: "syssetting",
        },
        {
          path: "sysstorage",
          component: SysStorage,
          meta: "sysstorage",
          name: "sysstorage",
        },
        {
          path: "runninginfo",
          component: RunningInfo,
          meta: "runninginfo",
          name: "runninginfo",
        },
        {
          path: "netsetting",
          component: NetSetting,
          meta: "netsetting",
          name: "netsetting",
        },{
          path: "webdav",
          component: webdav,
          meta: "webdav",
          name: "webdav",
        },{
          path: "swagger",
          component: swagger,
          meta: "swagger",
          name: "swagger",
        }
      ]
    }, {
      //media-------------------------------
      path: "/media",
      component: media,
      meta: "media",
      name: "media",
      children: [
        {
          path: "",
          component: LayoutSwitch,
          redirect: "/media/layoutswitch",
          meta: "layoutswitch",
          name: "layoutswitch",
        },
        {
          path: "inputchannelsetting",
          component: InputChannelSetting,
          meta: "inputchannelsetting",
          name: "inputchannelsetting",
        },
        {
          path: "inputdevsetting",
          component: InputDevSetting,
          meta: "inputdevsetting",
          name: "inputdevsetting",
        },
        {
          path: "outputchannelsetting",
          component: OutputChannelSetting,
          meta: "outputchannelsetting",
          name: "outputchannelsetting",
        },
        {
          path: "outputdevsetting",
          component: OutputDevSetting,
          meta: "outputdevsetting",
          name: "outputdevsetting",
        },
        {
          path: "multicast",
          component: multicast,
          meta: "multicast",
          name: "multicast",
        },
        {
          path: "streampull",
          component: StreamPull,
          meta: "streampull",
          name: "streampull",
        },
        {
          path: "streampush",
          component: StreamPush,
          meta: "streampush",
          name: "streampush",
        },
        {
          path: "streamswitch",
          component: StreamSwitch,
          meta: "StreamSwitch",
          name: "StreamSwitch",
        },
        {
          path: "audioswitch",
          component: AudioSwitch,
          meta: "audioswitch",
          name: "audioswitch",
        },
        {
          path: "layoutswitch",
          component: LayoutSwitch,
          meta: "layoutswitch",
          name: "layoutswitch",
        },
        {
          path: "layoutmanage",
          component: LayoutManage,
          meta: "layoutmanage",
          name: "layoutmanage",
        },
      ]
    }, {
      //kvm-------------------------------
      path: "/kvm",
      component: Kvm,
      meta: "kvm",
      name: "kvm",
      children: [
        {
          path: "",
          component: COMSetting,
          redirect: "/kvm/comsetting",
        }, 
        {
          path: "comsetting",
          component: COMSetting,
          meta: "comsetting",
          name: "comsetting",
        },      
        {
          path: "irsetting",
          component: IRSetting,
          meta: "irsetting",
          name: "irsetting",
        },      
        {
          path: "kvmDetail",
          component: kvmDetail,
          meta: "kvmDetail",
          name: "kvmDetail",
        },      
      ]
    }, {
      //kvm-------------------------------
      path: "/debug",
      component: Debug,
      meta: "debug",
      name: "debug",
      children: [
        {
          path: "",
          component: PacketCapture,
          redirect: "/debug/packetcapture",
        }, 
        {
          path: "packetcapture",
          component: PacketCapture,
          meta: "packetcapture",
          name: "packetcapture",
        }
      ]
    }
  ]
},
{
  path: "*",
  component: notfound
}
];

export default new Router({
	history: false,
	routes,
	strict: process.env.NODE_ENV !== "production"
});